from goods.models import GoodsChannel, GoodsChannelGroup, GoodsCategory
from rest_framework import serializers



#1.channel序列化器
class channelViewSetSerializer(serializers.ModelSerializer):
    group = serializers.StringRelatedField(read_only=True)
    group_id = serializers.IntegerField()
    category = serializers.StringRelatedField(read_only=True)
    category_id = serializers.IntegerField()

    class Meta:

        model=GoodsChannel
        fields="__all__"

class ChannelTypesViewSetSerializer(serializers.ModelSerializer):
    class Meta:
        model=GoodsChannelGroup
        fields="__all__"



class CategoriesViewSetSerializer(serializers.ModelSerializer):
    class Meta:
        model=GoodsCategory
        fields="__all__"